<?php 
namespace app\api\model;

class Login extends Base
{
    /**
     * 登录
     * @param array $data
     * @return array
     */
    public function login(array $data):array
    {
        $info = model('member')->getInfo([ ['username', '=', $data['username']], ['password', '=', md5($data['password'])] ], 'member_id');
        if (empty($info['member_id'])) return error(['msg' => '用户名或密码错误']);
        else return success(['data' => $info['member_id']]);
    }
}

?>